﻿using System.Collections.Generic;
using System.IO;
using Isis.Interfaces;
using Isis.Model;
using Isis.Views;

namespace Isis.Controllers
{
    public class HomePageController : ControllerBase
    {
        private readonly string _basePath;

        public HomePageController(string basePath)
        {
            _basePath = basePath;
        }

        public override ControllerTab Tab
        {
            get { return new ControllerTab("Home", 0); }
        }

        public override void Render(TextWriter writer)
        {
            var pageLayoutWriter = new PageLayoutWriter(Tab.Title, Action, new ControllerRepository(), _basePath);
            pageLayoutWriter.RenderPage(writer, RenderContent);
        }

        private void RenderContent(TextWriter writer)
        {
            RenderSummary(writer);
        }

        private void RenderSummary(TextWriter writer)
        {
            writer.Write("<p>This is your site's dashboard and control panel.</p>");
        }
    }
}